package com.tiandao.mofang.core.jingji;

import com.tiandao.mofang.core.RobotSingleton;

import java.awt.*;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.util.Random;

/**
 *  竞技基类
 *  提供竞技细分玩法的开始操作
 */
public class BaseJingJi {

    private static Robot robot = RobotSingleton.getInstance();

    public static void main(String[] args) {
//        robot.mouseMove(1500,1055);//pvp按钮屏幕坐标
//        robot.mouseMove(1495,1025);//竞技按钮屏幕坐标
//        robot.mouseMove(792,303);//论剑按钮坐标
//        robot.mouseMove(1000,710);//论剑开始按钮坐标
//        robot.mouseMove(960,220);//论剑准备按钮
    }
    /**
     * 打开竞技界面
     * 两种打开方式 随机数 确定一种
     */
    public static void OpenJieMian(){
        try {
            //随机一个正整数
            Random random = new Random();
//            int x = 0;
//            int y = 0;
//            for (int i = 1;i<=10000;i++){
            int a = random.nextInt(2);
//                System.out.println(a);
//                if(a==0){
//                    x++;
//                }else{
//                    y++;
//                }
//            }
            Thread.sleep(5000);
//            System.out.println(x);
//            System.out.println(y);
            //a = 0 Ctrl + D
            if(a==0){
                Thread.sleep(1000);
                robot.keyPress(KeyEvent.VK_CONTROL);
                robot.keyPress(KeyEvent.VK_D);
                Thread.sleep(500);
                robot.keyRelease(KeyEvent.VK_D);
                robot.keyRelease(KeyEvent.VK_CONTROL);
                //成功打开
            }
            //a=1 鼠标操作
            if(a==1){
                //移动鼠标到PVP上并点击
                Thread.sleep(1000);
                robot.mouseMove(1500,1055);
                Thread.sleep(1000);
                robot.mousePress(InputEvent.BUTTON1_MASK);
                robot.mouseRelease(InputEvent.BUTTON1_MASK);
                //移动鼠标到竞技上并点击
                Thread.sleep(1000);
                robot.mouseMove(1495,1025);
                Thread.sleep(1000);
                robot.mousePress(InputEvent.BUTTON1_MASK);
                robot.mouseRelease(InputEvent.BUTTON1_MASK);
                //成功打开
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }


    /**
     * 松林问战排队操作
     */
    public static void OpenSongLin(){
        OpenJieMian();

    }

    /**
     * 长洲孤月排队操作
     */
    public static void OpenChangZhou(){
        OpenJieMian();

    }

    /**
     * 王府乱斗排队操作
     */
    public static void OpenWanFu(){
        OpenJieMian();

    }

    /**
     * 潜龙之渊排队操作
     */
    public static void OpenQianLong(){
        OpenJieMian();

    }

    /**
     * 徐海之战排队操作
     */
    public static void OpenXuHai(){
        OpenJieMian();

    }

    /**
     * 莲花之境排队操作
     */
    public static void OpenLianHua(){
        OpenJieMian();

    }




}
